package com.aspyn.tetris;

import android.graphics.Color;
import android.graphics.Point;
import android.graphics.PointF;
import android.widget.Toast;

enum ShapeType {
	NONE, SQUARE, LLEFT, LRIGHT, S, Z, T, STICK
}

public class Shape {
	private int color;
	
	final int squareColor = Color.BLUE;
	final int lrightColor = Color.RED;
	final int lleftColor = Color.GREEN;
	final int zColor = Color.CYAN;
	final int sColor = Color.YELLOW;
	final int tColor = Color.WHITE;
	final int stickColor = Color.GRAY;
	
	Point[] occPoints = new Point[4];
	
	int[] shapeColArr = {squareColor,lleftColor,lrightColor,sColor,zColor,tColor,stickColor};
	
	ShapeType shapeType;
	
	SquareShape square;
	LLeftShape lleft;
	LRightShape lright;
	StickShape stick;
	ZShape zK;
	SShape sK;//k is for no reason
	TShape tK;
	
	public void create(ShapeType sT, Point p, GridManager gM) {
		shapeType = sT;
		switch (sT) {
		case SQUARE:
			color = squareColor;
			SquareShape s = new SquareShape();
			s.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			square = s;
			occPoints = s.getOccupiedPoints();
			break;
		case LLEFT:
			color = lleftColor;
			LLeftShape t = new LLeftShape();
			t.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			lleft = t;
			occPoints = t.getOccupiedPoints();
			break;
		case LRIGHT:
			color = lrightColor;
			LRightShape o = new LRightShape();
			o.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			lright = o;
			occPoints = o.getOccupiedPoints();
			break;
		case S:
			color = sColor;
			SShape b = new SShape();
			b.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			sK = b;
			occPoints = b.getOccupiedPoints();
			break;
		case Z:
			color = zColor;
			ZShape k = new ZShape();
			k.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			zK = k;
			occPoints = k.getOccupiedPoints();
			break;
		case T:
			color = tColor;
			TShape d = new TShape();
			d.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			tK = d;
			occPoints = d.getOccupiedPoints();
			break;
		case STICK:
			color = stickColor;
			StickShape a = new StickShape();
			a.createShapeWithTopCornerAtPt((int)p.x, (int)p.y, gM);
			stick = a;
			occPoints = a.getOccupiedPoints();
			break;
		default:
			break;
		}
	}
	
	public void rotate() {
	
	}
	
	public int getColor(ShapeType shape) {
		//1 is square, 2 is LLeft, 3 is LRight, 4 is S, 5 is Z, 6 is T, 7 is Stick
		switch (shape) {
		case SQUARE:
			color = squareColor;
			break;
		case LLEFT:
			color = lleftColor;
			break;
		case LRIGHT:
			color = lrightColor;
			break;
		case S:
			color = sColor;
			break;
		case Z:
			color = zColor;
			break;
		case T:
			color = tColor;
			break;
		case STICK:
			color = stickColor;
			break;
		default:
			break;
		}
		return color;
		
	}
/*
	public int getColorForShapeType(ShapeType sT) {
		
		
		switch (sT) {
		case SQUARE:
			color = squareColor;
			break;
		case LLEFT:
			color = lleftColor;
			break;
		case LRIGHT:
			color = lrightColor;
			break;
		case S:
			color = sColor;
			break;
		case Z:
			color = zColor;
			break;
		case T:
			color = tColor;
			break;
		case STICK:
			color = stickColor;
			break;
		default:
			break;
		}
		return color;
	}*/
}
